﻿$(document).ready(function () {
    $("#logon").click(function () {
        Login();
    });
});

function Login() {
    var username = $("#username").val();
    var password = $("#password").val();
    var parm = {
        UserName: username,
        Password: password,
        RememberMe: true,
        returnUrl: null
    };
    $.ajax({
        url: '/Account/LogOn',
        type: 'POST',
        data: JSON.stringify(parm),
        contentType: 'application/json; charset=utf-8',
        success: function (data) {
            document.write(data);
        },
        error: function () {
            alert("Username and/or password is invalid.");
        }
    });
}